package com.wzy.floatactionbutton2;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;

/**
 * Created by wangzhenyu on 2016/8/10.
 */
public class MyListView extends ListView {

    private ViewMoveListener mMoveListener;

    public MyListView(Context context) {
        super(context);
    }

    public MyListView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyListView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setListViewMoveListener(ViewMoveListener moveListener) {
        this.mMoveListener = moveListener;
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (mMoveListener != null) {
            mMoveListener.onMoving(event);
        }
        return super.dispatchTouchEvent(event);
    }
}
